
{extend name="layout/base"}
{block name="title"}用户信息{/block}
{block name="css"}
<link href="__admin_static__/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="__admin_static__/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
{/block}
{block name="head_js"}{/block}
{block name="body"}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>用户信息　<a target="_self" href="{:url('export')}"><span class="btn btn-w-m btn-primary"><i class="glyphicon glyphicon-download-alt"></i> 导出Excel</span></a></h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                    <div class="clearfix" style="clear: both"></div>
                </div>

            </div>
        </div>

    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form method="post" action="{:url('index')}" target="_self">
                        <div class="row">
                            <div class="col-sm-2  m-b-xs" style="width: 10%">
                                <div class="input-group">
                                    <input name="start_time" id="time" type="text" {if condition="!empty($input['start_time'])"}value="{$input['start_time']}"{/if} placeholder="开始时间" class="input-sm form-control">
                                </div>
                            </div>
                            <div class="col-sm-2  m-b-xs">
                                <div class="input-group">
                                    <input name="end_time" id="time1" type="text" {if condition="!empty($input['end_time'])"}value="{$input['end_time']}"{/if} placeholder="结束时间" class="input-sm form-control">
                                </div>
                            </div>
                            <div class="col-sm-4  m-b-xs">
                                <div class="input-group">
                                    <input name="keyword" type="text" {if condition="!empty($input['keyword'])"}value="{$input['keyword']}"{/if} placeholder="输入关键词[用户,联系,公司]" class="input-sm form-control"> <span class="input-group-btn">
                                            <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                        </div>
                    </form>
                    <div class="table-responsive">
                        <form method="post" action="{:url('delAll')}" id="ListForm"  target="_self">
                            <table class="table table-striped">
                                <thead>
                                <tr>

                                    <th></th>
                                    <th>用户</th>
                                    <th>联系</th>
                                    <th>公司</th>
                                    <th>时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {foreach name="list" item="data"}
                                <tr>
                                    <td>
                                        <input type="checkbox" class="i-checks" value="{$data.id}" name="id[]">
                                    </td>
                                    <td>{$data.name}</td>
                                    <td>{$data.phone}</td>
                                    <td>{$data.company}</td>
                                    <td>{$data.add_time|date='Y-m-d H:i',###}</td>
                                    <td>

                                        <a href="{:url('edit',['id'=>$data.id])}" target="_self"><i class="glyphicon glyphicon-pencil text-navy"></i></a>　
                                        <a  data-toggle="modal" onclick="javascript:showModal('{$data.client_id}')" target="_self"><i class="fa fa-commenting text-warning"></i></a>　
                                        <a  target="_self" onclick="javascript:Base_warning_location({title:'你确定给删除吗',text:'删除后将无法操作',confirmText:'删除',location:'{:url('del',['id'=>$data.id])}',});"><i class="glyphicon glyphicon-remove text-danger"></i></a>
                                    </td>
                                </tr>
                                {/foreach}
                                </tbody>
                            </table>
                        </form>
                    </div>
                    <div class="row">
                        <div class="col-sm-5 m-b-xs">
                            <div class="pagination">
                                <button type="button" class="btn btn-w-m btn-default" onclick="javascript:Base_warning_form({target:'ListForm','title':'您确定删除被选中的用户信息吗'})">批量删除</button>
                            </div>
                        </div>
                        <div class="col-sm-7 m-b-xs">
                            <nav aria-label="Page navigation">
                                <style>
                                    .pagination > .active > span{
                                        background-color: #1c84c6 !important;
                                        color: #fff;
                                        border-color: #1c84c6;
                                    }
                                </style>
                                {$page}
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <form action="{:url('chat_log')}" enctype="multipart/form-data" target="_self" method="get">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" onclick="javascript:showModal()"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
                    </button>
                    <i class="glyphicon glyphicon-download modal-icon"></i>
                    <h4 class="modal-title">下载聊天记录</h4>
                    <small class="font-bold">您可以下载该用户与客服的聊天记录！</small>
                </div>
                <div class="modal-body">
                    <div class="form-group"><label>请选择客服</label></div>
                    <select class="form-control m-b" name="tid">
                        {foreach name="kf_list" item="kf"}
                        <option value="{$kf.kf_id}">用户名: {$kf.kf_username} ，昵称: {$kf.nickname}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="modal-footer">
                    <input type="hidden" name="fid" value="">
                    <button type="button" class="btn btn-white" onclick="javascript:showModal()">关闭</button>
                    <button type="submit" class="btn btn-primary" >下载</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="__admin_static__/js/jquery.min.js?v=2.1.4"></script>
<script src="__admin_static__/js/bootstrap.min.js?v=3.3.5"></script>
<script src="__admin_static__/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__admin_static__/js/content.min.js?v=1.0.0"></script>
<script src="__admin_static__/js/plugins/iCheck/icheck.min.js"></script>
<script src="__admin_static__/js/demo/peity-demo.min.js"></script>
<script src="__admin_static__/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="__admin_static__/js/plugins/layer/laydate/laydate1.js"></script>
<script src="__admin_static__/js/base.js"></script>
<script>
    $(document).ready(function(){
        $(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
        //日期范围
        laydate.render({
            elem: '#time'
            ,type : "datetime"
        });
        laydate.render({
            elem: '#time1'
            ,type : "datetime"
        });
    });

    function showModal(fid)
    {
        var display = $('#myModal').css('display');
        if(display == 'none')
        {
            $('#myModal').addClass('in').show();
            $('#myModal input[name="fid"]').val(fid);
        }
        else
        {
            $('#myModal').removeClass('in').hide();
        }
    }

</script>
</body>
{/block}
